//
//  SMACTrendMoadel.swift
//  SmiraAiChat
//
//  Created by mumu on 2024/9/23.
//

import UIKit
//帖子
class SMACTrendMoadel:Codable {
    var title :String?
    var content :String?
    var visioncount :Int?
    var ifcansee :Bool?
    var images :Array<String>?
    var replays :Array<String>?
    
    enum CodingKeys: String, CodingKey {
        case title
        case content
        case visioncount
        case ifcansee
        case images
        case replays
    }

    required init(from decoder: Decoder) throws {
        let container = try decoder.container(keyedBy: CodingKeys.self)
        
        
        title = try container.decodeIfPresent(String.self, forKey: .title)
        content   = try container.decodeIfPresent(String.self, forKey: .content)
        visioncount   = try container.decodeIfPresent(Int.self, forKey: .visioncount)
     
        ifcansee  = try container.decodeIfPresent(Bool.self, forKey: .ifcansee)
       
        images   = try container.decodeIfPresent(Array<String>.self, forKey: .images)
        replays  = try container.decodeIfPresent(Array<String>.self, forKey: .replays)
     
    }
     
    
    init(trendDic:[String:Any]) {
        title = trendDic["title"] as? String
        content = trendDic["content"] as? String
        ifcansee = trendDic["ifcansee"] as? Bool
        images = trendDic["images"] as? Array<String>
        replays = trendDic["replays"] as? Array<String>
    }
}

